package system;

import com.moedik.webservice.ShippingServiceType;
import java.util.ArrayList;

/**
 *
 * @author Rezan Achmad
 */
public class WebService {

    public final static String ORIGIN_CITY = "Bandung";

    public static java.util.List<com.moedik.webservice.ShippingServiceType> getShippingServices() {
        com.moedik.webservice.MoedikWS_Service service = new com.moedik.webservice.MoedikWS_Service();
        com.moedik.webservice.MoedikWS port = service.getMoedikWSPort();
        return port.getShippingServices();
    }

    public static java.util.List<com.moedik.webservice.ShippingServiceType> getShippingServices(boolean spesificOrigin) {
        ArrayList<ShippingServiceType> shippings = (ArrayList<ShippingServiceType>) getShippingServices();
        for (int i = 0; i < shippings.size(); ++i) {
            if (!shippings.get(i).getOriginCity().equals(ORIGIN_CITY)) {
                shippings.remove(i);
                --i;
            }
        }
        return shippings;
    }
}